/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

package com.facebook.drawee.backends.pipeline.debug;

import com.facebook.drawee.backends.pipeline.info.ImageOrigin;
import ohos.agp.utils.Color;
import ohos.utils.PlainIntArray;

public class DebugOverlayImageOriginColor {

  private static final PlainIntArray IMAGE_ORIGIN_COLOR_MAP = new PlainIntArray(7);

  static {
    IMAGE_ORIGIN_COLOR_MAP.append(ImageOrigin.UNKNOWN, Color.GRAY.getValue());
    IMAGE_ORIGIN_COLOR_MAP.append(ImageOrigin.NETWORK, Color.RED.getValue());
    IMAGE_ORIGIN_COLOR_MAP.append(ImageOrigin.DISK, Color.YELLOW.getValue());
    IMAGE_ORIGIN_COLOR_MAP.append(ImageOrigin.MEMORY_ENCODED, Color.YELLOW.getValue());
    IMAGE_ORIGIN_COLOR_MAP.append(ImageOrigin.MEMORY_BITMAP, Color.GREEN.getValue());
    IMAGE_ORIGIN_COLOR_MAP.append(ImageOrigin.MEMORY_BITMAP_SHORTCUT, Color.GREEN.getValue());
    IMAGE_ORIGIN_COLOR_MAP.append(ImageOrigin.LOCAL, Color.GREEN.getValue());
  }

  public static int getImageOriginColor(int imageOrigin) {
    return IMAGE_ORIGIN_COLOR_MAP.get(imageOrigin, Color.WHITE.getValue());
  }
}
